﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace CheckTTS
{
    class VoiceTag
    {
        public const string VOICE_TAG = "voice_role";
        public const string ROLE_KEY = "role";
        public const string EMOTION_KEY = "emotion";
        public const string BACKGROUND_MUSIC_KEY = "backgroundMusic";
        public const string SOUND_EFFECT_KEY = "soundEffect";
        /*
        section：要读取的段落名
        key: 要读取的键
        defVal: 读取异常的情况下的缺省值
        retVal: key所对应的值，如果该key不存在则返回空值
        size: 值允许的大小
        filePath: INI文件的完整路径和文件名   
         */
        [DllImport("kernel32")]  
        private static extern int GetPrivateProfileString(string section, string key, string defVal, StringBuilder retVal, int size, string filePath);
        private static string INI_PATH = Path.Combine(System.Windows.Forms.Application.StartupPath, "checkVoiceRole.ini");

        public static string getVoiceTag( string key)
        {
            StringBuilder temp = new StringBuilder(10000);
            GetPrivateProfileString(VOICE_TAG, key, "", temp, 10000, INI_PATH);
            return temp.ToString();
        }
    }
}
